package com.example.feng.testcsdn;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.example.feng.demo.ActivityDemo1;
import com.example.feng.demo.ActivityDemo2;

public class MainActivity extends Activity implements View.OnClickListener{


    private Button btnDemo1;
    private Button btnDemo2;
    private Button btnDemo3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initButtons();
    }

    private void initButtons(){

        btnDemo1 = (Button)findViewById(R.id.btn_demo1);
        btnDemo2 = (Button)findViewById(R.id.btn_demo2);
        btnDemo3 = (Button)findViewById(R.id.btn_demo3);

        btnDemo1.setOnClickListener(this);
        btnDemo2.setOnClickListener(this);
        btnDemo3.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()){
            case R.id.btn_demo1: {
                Intent intent = new Intent(MainActivity.this, ActivityDemo1.class);
                startActivity(intent);
                break;
            }
            case R.id.btn_demo2: {
                Intent intent = new Intent(MainActivity.this, ActivityDemo2.class);
                startActivity(intent);
                break;
            }
            case R.id.btn_demo3:{

                break;
            }
            default:
                break;
        }

    }


}
